package c.e.a.b.e.c;

import android.content.Context;
import android.database.ContentObserver;
import android.util.Log;
import b.i.b.f;
import c.e.a.b.b.j.d;
import javax.annotation.Nullable;

/* compiled from: com.google.android.gms:play-services-measurement-impl@@18.0.0 */
public final class c2 implements b2 {
    public static c2 c;
    @Nullable
    public final Context a;
    @Nullable
    public final ContentObserver b;

    public c2(Context context) {
        this.a = context;
        f2 f2Var = new f2();
        this.b = f2Var;
        context.getContentResolver().registerContentObserver(u1.a, true, f2Var);
    }

    public static c2 b(Context context) {
        c2 c2Var;
        synchronized (c2.class) {
            if (c == null) {
                c = (f.T(context, "com.google.android.providers.gsf.permission.READ_GSERVICES") == 0 ? 1 : null) != null ? new c2(context) : new c2();
            }
            c2Var = c;
        }
        return c2Var;
    }

    public final Object a(String str) {
        if (this.a == null) {
            return null;
        }
        try {
            return (String) d.t(new g2(this, str));
        } catch (IllegalStateException | SecurityException e) {
            String str2 = "Unable to read GServices for: ";
            str = String.valueOf(str);
            Log.e("GservicesLoader", str.length() != 0 ? str2.concat(str) : new String(str2), e);
            return null;
        }
    }

    public c2() {
        this.a = null;
        this.b = null;
    }
}
